import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 学生课程成绩信息 */
export interface StudentCourseScore {
          id: number; // 学生课程成绩ID
          teachingId: number; // 授课ID
          studentId?: number; // 学生ID
          score: number; // 成绩分数
          level: string; // 成绩等级ABCDEF
  }

// 学生课程成绩 API
export const StudentCourseScoreApi = {
  // 查询学生课程成绩分页
  getStudentCourseScorePage: async (params: any) => {
    return await request.get({ url: `/train/student-course-score/page`, params })
  },

  // 查询学生课程成绩详情
  getStudentCourseScore: async (id: number) => {
    return await request.get({ url: `/train/student-course-score/get?id=` + id })
  },

  // 新增学生课程成绩
  createStudentCourseScore: async (data: StudentCourseScore) => {
    return await request.post({ url: `/train/student-course-score/create`, data })
  },

  // 修改学生课程成绩
  updateStudentCourseScore: async (data: StudentCourseScore) => {
    return await request.put({ url: `/train/student-course-score/update`, data })
  },

  // 删除学生课程成绩
  deleteStudentCourseScore: async (id: number) => {
    return await request.delete({ url: `/train/student-course-score/delete?id=` + id })
  },

  /** 批量删除学生课程成绩 */
  deleteStudentCourseScoreList: async (ids: number[]) => {
    return await request.delete({ url: `/train/student-course-score/delete-list?ids=${ids.join(',')}` })
  },

  // 导出学生课程成绩 Excel
  exportStudentCourseScore: async (params) => {
    return await request.download({ url: `/train/student-course-score/export-excel`, params })
  }
}
